<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <!-- onkeydown 按下就会触发 -->
    <!-- onkeypress 是产生字符才触发-->
    <!-- onchange 内容改变才触发,需要敲回车 -->
    <input type="text"  onkeydown="show1()"><br>
    <input type="text"  onkeypress="show2()"><br>
    <input type="text"  onchange="show3()">

    <p id="p1"></p>
    <script>
    //页面加载完成会弹出事件
    window.onload = function a(){
        alert("欢迎访问")
    }
    
    function show1(){
        //1、获取p标签元素
        let node = document.getElementById("p1")
        //2、追加内容
        node.innerText += "onkeydown事件"
    }
    function show2(){
        //1、获取p标签元素
        let node = document.getElementById("p1")
        //2、追加内容
        node.innerText += "onkeypress事件"
    }
    function show3(){
        //1、获取p标签元素
        let node = document.getElementById("p1")
        //2、追加内容
        node.innerText += "onchange事件"
    }
    </script>
</body>
</html>